<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
</head>
<body>
    <div id="app">

    </div>
    <script type="text/javascript" src='../vue/dist/vue.js'></script>
    <script type="text/javascript">
    // input自动获取焦点
        var App = {
            template:  `<div>
                <input type="text" ref='input' name="" v-if='isShow' value="">
            </div>`,
            data: function(){
                return {
                    isShow: false
                }
            },
            mounted: function(){
                this.isShow = true
                this.$nextTick(function(){
                    this.$refs.input.focus()
                })
            }
        }
        new Vue({
            el: '#app',
            template: '<app/>',
            components: {
                app: App
            }
        })
    </script>
</body>
</html>